// pages/showaddress1/showaddress1.js
var util = require('../../../utils/util.js');
var app=getApp();

Page({
  /**
   * 页面的初始数据
   */
  data: {
    dialog4: {
      hidden: true
    },
    json: "",
    yfilename: "",
    yname: "",
    yphones:"",
    yowner: "",
    ysex: ""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var a = options.a;

    var aa = options.aa;
    var bb = options.bb;
    var cc = options.cc;
    var dd = options.dd;
    var ee = options.ee;

    var jsonData = JSON.parse(a);
    this.setData({ json: jsonData });
    this.setData({ yfilename: aa });
    this.setData({ yname: bb });
    this.setData({ yphones: cc });
    this.setData({ yowner: dd });
    this.setData({ ysex: ee });
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  address: function (e){
    var that=this;
    var address = e.currentTarget.id;
    app.address = address;
    app.yfilename = that.data.yfilename;
    app.yname = that.data.yname;
    app.yphones = that.data.yphones;
    app.ysex = that.data.ysex;
    that.setData({ 'dialog4.hidden': false });
      wx.request({
        url: 'https://wwl.ycws.cc/ssm/unitdoor/show', 
        data:{
          'address':address
        },
        header: {
          'content-type': 'application/json'
        },
        success: function (res) {
          console.log(res.data)
          that.setData({ list: res.data.list });
          var an = res.data;
          var json = JSON.stringify(an);
          app.json=json;
          that.setData({ 'dialog4.hidden': true });
          wx.switchTab({
            url: '../../../pages/Visitor/unitdoor/unitdoor'
          })
        }
      })
    }
})